﻿//----------------------------------------------------------------------------------------------------
// A NodeInstance is the representation of a node in a level
//----------------------------------------------------------------------------------------------------

package HG.Visual
{
	import flash.display.*;
	import flash.events.*;
	import flash.utils.Timer;
	import fl.transitions.Tween;
	import fl.transitions.easing.*;
	import fl.transitions.TweenEvent;
	
	import HG.GameService;
	import HG.Managers.NotificationManager;
	
	public class VisualNotificaitonBar extends MovieClip
	{
		var m_notificationManager:NotificationManager;
		
		var m_animTimer:Timer;
		
		//----------------------------------------------------------------------------------------------------
		public function VisualNotificaitonBar()
		{
			m_notificationManager = GameService.GetInstance().GetNotificationManager();
			m_notificationManager.RegisterNotificationBar(this);
			
			m_animTimer = new Timer(2000);
			m_animTimer.addEventListener(TimerEvent.TIMER, Close);
			
			this.alpha = 0;
		}
		

		//----------------------------------------------------------------------------------------------------
		public function SetValue(val:String)
		{
			TXT_Value.text = val;
			
			m_animTimer.reset();
			m_animTimer.start();
			
			new Tween(this, "alpha", Strong.easeInOut, this.alpha, 1, 0.5, true);
		}
		
		//----------------------------------------------------------------------------------------------------
		public function Close(evt:TimerEvent)
		{
			m_animTimer.stop();
			
			new Tween(this, "alpha", Strong.easeInOut, this.alpha, 0, 1, true);
		}
		
		//----------------------------------------------------------------------------------------------------
	}
}